{% extends "base_blank.volt" %}

{% block pageHeader %}
    <style type="text/css">
        .container, .container-fluid {
            min-width: 400px;
        }
    </style>
{% endblock %}

{% block pageFooter %}
    <script type="text/javascript">
        var contentType = '{{ type }}';
        var domainPic = '{{ this.di.get('appConfig').application.domainPic }}';
        $(function(){
            $('#form_img').on('valid.form', function(e, form){
                // 图片格式判断
                var img = $('#file_img').val();
                img = img.toLowerCase();
                if (!/\.(jpg|jpeg|png)$/.test(img)) {
                    alert("图片类型必须是jpg,png中的一种");
                    return false;
                }
                layer.load();
                form.submit();
            });
        });
    </script>
{% endblock %}

{% block content %}
<div class="container-fluid" id="content_box_blank">
    <div class="row">
        <div class="col-xs-12">
            <form id="form_img" role="form" method="post" action="{{ url.get('tools/editorPTUploadImg') }}" enctype="multipart/form-data">
                <div class="form-group">
                    <label for="file_img">请选择图片文件</label>
                    <input type="hidden" name="content_type" value="{{ type }}">
                    <input type="hidden" name="callback" value="{{ callback }}">
                    <input class="form-control" type="file" id="file_img" name="file" data-rule="required;" data-target="#error_box">
                    <p class="help-block" id="error_box"></p>
                    <p class="help-block">支持jpg、png图片格式，宽必须是750px，大小不得超过1M。</p>
                </div>
                <div class="form-group text-right">
                    <button type="submit" class="btn btn-primary"><i class="fa fa-file-image-o"></i> 上 传</button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}